package com.eptok.gw.szcups.pojo;

import org.dom4j.Document;
import org.dom4j.Element;

import ys8583.parse.IOMessage;


/**
 *@author:heqishan, Email:heqishan@gmail.com
 *2013-3-18 上午10:01:54
 */
public class CardPay extends XmlMessage{
	private String amount;				//金额(分)
	private PosData posData;
//--------------响应-----------------------------
	
	
	public String getAmount() {
		return amount;
	}
	public void setAmount(String amount) {
		this.amount = amount;
	}
	public PosData getPosData() {
		return posData;
	}
	public void setPosData(PosData posData) {
		this.posData = posData;
	}

	
	@Override
	protected void decodeBody(Document document) throws Exception {
		reqSerialNumber = ((Element) document.selectObject("/szcups/body/ReqSerialNumber")).getTextTrim();
		amount = (((Element) document.selectObject("/szcups/body/PayAmount")).getTextTrim());
		posData = decodePosData(document);
	}
	@Override
	protected String encodeBody(IOMessage iomessage) throws Exception {
		StringBuffer sb = new StringBuffer();
		sb.append("<body>");
		sb.append("<ReqSerialNumber>").append(reqSerialNumber).append("</ReqSerialNumber>");
		sb.append("<PayAmount>").append(amount).append("</PayAmount>");
		sb.append("<RspSerialNumber>").append(rspSerialNumber).append("</RspSerialNumber>");
		sb.append(encodeCupsResult(iomessage));
		sb.append("</body>");
		return sb.toString();
	}
	
	
	
}
